package com.hashcoding.eyes.module.manager;

import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;

import static com.hashcoding.eyes.EyesApplication.gContext;
/**
 * AppBroadcastManager
 *
 * @author Maochuan
 * @date 2016-02-03
 */
public class AppBroadcastManager {

    public static void register(BroadcastReceiver receiver, IntentFilter filter) {
        LocalBroadcastManager.getInstance(gContext).registerReceiver(receiver, filter);
    }

    public static void unregister(BroadcastReceiver receiver) {
        LocalBroadcastManager.getInstance(gContext).unregisterReceiver(receiver);
    }

    public static void sendBroadcast(Intent intent) {
        LocalBroadcastManager.getInstance(gContext).sendBroadcast(intent);
    }

    public static void sendBroadcastSync(Intent intent) {
        LocalBroadcastManager.getInstance(gContext).sendBroadcastSync(intent);
    }
}
